package com.mine.modules.vm.controller;


import com.mine.common.domain.vo.Result;
import com.mine.modules.vm.domain.dto.AddOrEditAssetDto;
import com.mine.modules.vm.domain.dto.AssetsPersonnelDto;
import com.mine.modules.vm.domain.dto.BindingSensor;
import com.mine.modules.vm.domain.query.AssetsPageQuery;
import com.mine.modules.vm.entity.VmAssets;
import com.mine.modules.vm.service.IVmAssetsPersonnelService;
import com.mine.modules.vm.service.IVmAssetsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author xujf
 * @since 2024-09-21
 */
@RestController
@RequestMapping("/vm/asset/personnel")
@RequiredArgsConstructor
@Api(tags = "设备-人员管理")
public class VmAssetsPersonnelController {

    private final IVmAssetsPersonnelService vmAssetsPersonnelService;

    @ApiOperation(value = "查询设备已绑定人员Id集合", notes = "查询设备已绑定人员Id集合")
    @RequestMapping(value = "/getPersonnelIdsByDeviceId", method = {RequestMethod.GET})
    public Result<?> getPersonnelIdsByDeviceId(@RequestParam String deviceId, @RequestParam(required = false) String personnelType) {
        return vmAssetsPersonnelService.getPersonnelIdsByDeviceId(deviceId, personnelType);
    }

    @ApiOperation(value = "批量新增设备人员", notes = "批量新增设备人员")
    @RequestMapping(value = "/batchBindingPersonnelByDeviceId", method = {RequestMethod.POST})
    public Result<?> batchBindingPersonnelByDeviceId(AssetsPersonnelDto assetsPersonnel) {
        return vmAssetsPersonnelService.batchBindingPersonnelByDeviceId(assetsPersonnel);
    }

}
